<template>
  <div></div>
</template>
<script>
export default {
  nmae: "Loading",
  components: {},
  data() {
    return {
      map: null,
    };
  },
  methods: {
    show() {
      // this.$router.replace({
      //       path: "/mainPage"
      //     });
      //     return;
      const actionList = Object.keys(this.$store._actions).filter(
        (actionName) => actionName.startsWith("data/")
      );
      const taskList = [];
      actionList.forEach((actionName) =>
        taskList.push(this.$store.dispatch(actionName))
      );
      Promise.all(taskList)
        .then((results) => {
          console.log("所有异步任务已完成，结果为：", results);
          actionList.forEach((actionName, index) => {
            const commitAction = actionName.split("/")[1].toUpperCase();
            this.$store.commit(`data/${commitAction}`, results[index]);
          });
          this.$router.replace({
            path: "/mainPage"
          });
        })
        .catch((error) => {
          console.error("发生错误：", error);
        });
    },
  },
};
</script>
<style scoped>
</style>